public class TestDemo {
    public static void main(String[] args) {
        double sum = 0;
        double ret = 1;


        int n = 20;
        for (int i = 1; i <= n ; i++) {
            for (int j = 1; j <= i; j++) {
                ret *= j;
            }
            sum += 1 / ret*1.0;
            ret = 1;
        }
        System.out.println(sum);
    }
}

class Test{
    public static void main(String[] args) {
        double sum = 0;
        double item = 1;
        int i= 1;
        int n =20;
        while(i <= n){
            sum += item;
            i += 1;
            item = item *(1.0 /i);

        }
        System.out.println("sum="+sum);
    }

}